<html>
<head>
  <title>XQDebug Project Overview</title>
  <meta http-equiv="Content-Type" content="text/html;"/>
  <style type="text/css">
    .unimplemented { color:red; }
  </style>
</head>

<body lang="EN-US">
  <h1>XQDebug - MarkLogic XQuery Debugger</h1>
  <div id="project-overview">
    <h2>Project Overview:</h2>

    <p>The goal of XQDebug is to provide a Browser based debugger that is
    independent of any editor or browser, and can be installed and available for developers and
    administrators to develop and debug applications.</p>

    <p>XQDebug uses the MarkLogic debugging API (dbg) as much as possible to accomplish debugging tasks. Where the dbg library does not yet
        provide functionality, or we encounter bugs, we may need to create workarounds until a fix or update is available.</p>
    
    <p>XQDebug must run from and write to a database that is independent of any application or XQuery code being debugged. Otherwise it is
        possible to introduce changes in the state of the application that is being debugged. Therefore the install must create a database
        named XQDebug and copy all code and write all persisted information to that database. </p>
    
  </div>
  
  <div id="task_list">
    <h2>Prioritized Task (Feature) List:</h2>
    
    <p>The priority of this list is only approximate because features are also grouped 
      logically and some featues in a group have a lower priority of being implemented.
      The features which are listed in <strong class="unimplemented">red</strong> have not been implemented yet.
    </p>
    
    <ol>
     <li>Windowing and window Layout (As functionality is added ...)</li>
     <li>Debug environment
     <ul>
      <li>Debugger role ("_xqdebug-role")
        <ul>
         <li>Inherits "admin" role</li>
        </ul>
      </li>
       
      <li>Debugger user ("xqdebug")
        <ul>
         <li>with "_xqdebug-role" role</li>
        </ul>
      </li>
       
      <li>Create "XQDebug" database"
        <ul>
         <li>collectionLexicon = "true"</li>
         <li>wordLexicon = collation: http://marklogic.com/collation/codepoint</li>
         <li>Create "/content/xqdebug/" directory
           <ul style="list-style-type:disc;">
            <li>Clear permissions and privileges on directory</li>
            <li>Set URI privilege with "_xqdebug-role" role</li>
            <li>Set riu pemissions for "_xqdebug-role" role</li>
           </ul>
         </li>
        </ul>
      </li>
      <li>In Debug database create "/code/xqdebug/" directory
        <ul>
         <li>URI Lexicon = true</li>
         <li>Clear permissions and privileges on directory</li>
         <li>Set URI privilege with "_xqdebug-role" role</li>
         <li>Set rx pemissions for "_xqdebug-role" role</li>
         <li>Load code from zip file</li>
        </ul>
      </li>
      <li>HTTP Server ("_xqdebug-http")
        <ul>
         <li>Port = 9800</li>
         <li>Database = "XQDebug"</li>
         <li>Modules = "XQDebug"</li>
         <li>Digest authentication</li>
         <li>Nobody default user</li>
         <li>Debugging disallowed</li>
         <li>Profiling disallowed</li>
        </ul>
      </li>
     </ul>
     </li>
    <li>Connect to and Disconnect from application server
      <ul style="list-style-type:circle;">
        <li>List of Application Servers in a table or window listing
          <ul style="list-style-type:square;">
            <li>The number of currently stopped and running requests</li>
            <li>Application server settings for debug, profile &amp; logging</li>
            <li>Default modules and content databases</li>
          </ul>
        </li>
        <li>On connect create list of all .xqy URIs available for debugging on that server.</li>
      </ul>
    </li>        
    <li>Attach/Detach/<span class="unimplemented">Break into Request</span>
      <ul>
        <li>List of Requests (table or window): stopped, debugging</li>
        <li class="unimplemented">List of <em><strong>Running</strong></em> requests with link or button to stop or break into the request for debugging</li>
      </ul>
    </li>
    <li>Expression Display
      <ul style="list-style-type:circle;">
      <li>Retrieve and Persist Expression IDs
        <ul>
        <li>Retrieve &amp; display source line(s)</li>
         <li>Page</li>
         <li>Source File
           <ul style="list-style-type:disc;">
           <li>Source for current expression</li>
           <li class="unimplemented">Select source file to display from application servers .xqy list.</li>
         </ul>
         </li>
        </ul>
      </li>
      </ul>
    </li>
    <li>Execution
      <ul style="list-style-type:circle;">
        <li>Display
          <ul><li>Scroll source window so to current line.</li></ul>
        </li>
        <li>Stop &amp; Continue
          <ul><li class="unimplemented">jQuery for step/wait/eval</li></ul>
        </li>
        <li>Step
          <ul>
            <li>Step</li>
            <li>Next Expression</li>
            <li>Next Statement</li>
            <li>Finish (function)</li>
            <li>Run/Continue</li>
          </ul>
        </li>
      </ul>
    </li>
    <li>Breakpoints
      <ul>
        <li>Set</li>
        <li>Display</li>
        <li>Clear</li>
        <li>Persist Breakpoints between sessions</li>
      </ul>
     </li>
    <li>Stack Trace Frames with:
      <ul>
        <li>Source Line</li>
        <li>Variables</li>
        <li class="unimplemented">Global variables</li>
        <li class="unimplemented">External variables</li>
      </ul>
    </li>
    <li>Standalone Deployment program</li>
    <li>Watch window expressions</li>
    <li class="unimplemented">Invoke module for debugging
      <ul>
        <li>browser style URL for HTTP 'GET</li>
        <li>setup 'POST' frame</li>
        <li>jQuery select from application source files</li>
      </ul>        
    </li>
    <li class="unimplemented">Eval() expression for debugging
      <ul>
        <li class="unimplemented">CQ style textbox to edit and expression</li>
        <li class="unimplemented">Button to run an expression ... except on execution expression is stopped on first line for debugging</li>
        <li class="unimplemented">Results window</li>
      </ul>
    </li>
    <li>Windows &amp; tables
      <ul>
        <li>Resize, <span class="unimplemented">Expand &amp; collapse</span>
          <ul>
            <li>Persist between sessions</li>
          </ul>
        </li>
        <li class="unimplemented">Placement (rearrange) on screen
          <ul>
            <li class="unimplemented">Persist locations between sessions</li>
          </ul>
        </li>
      </ul>
    </li>
    <li class="unimplemented">Source Editing:
      <ul>
        <li>jQuery source editor</li>
        <li>Edit</li>
        <li>Save</li>
        <li>Source Syntax highlighting</li>
        <li>Hover display of:
          <ul>
            <li>Variable value</li>
            <li>Expression value</li>
            <li>Function return value</li>
          </ul>
        </li>
        <li>Select and Right click (jQuery) to:
          <ul>
            <li>Variable type</li>
            <li>Add to watch expressions</li>
            <li>Run to cursor</li>
          </ul>
        </li>
        <li>...</li>
      </ul>
    </li>
        
    <li>CSS for display styles:
      <ul>
        <li>Breakpoints</li>
        <li class="unimplemented">Hover on expression (highlight containing expression)</li>
      </ul>
    </li>
    </ol>
  </div>
    
  <div id="persist_information">
    <b>Debug Information Persisted to User Session File in XQDebug Database (As needed):</b>
    <ol>
      <li>All debug information associated with User Name</li>
      <li>App Server(s) State (Connected/Disconnected)
        <ul>
          <li>On Connect:
            <ul>
              <li class="unimplemented">Create list of all .xqy files in app-server modules DB below modules root</li>
              <li class="unimplemented">Save last expr-id of each line of each file</li>
            </ul>
          </li>
        </ul>
        
      </li>
      <li>Current request</li>
      <li>Watch expressions</li>
      <li class="unimplemented">Breakpoints</li>
      <li class="unimplemented">Associate Applications with their servers, databases and XQuery modules</li>
      <li class="unimplemented">Eval Expression</li>
      <li class="unimplemented">Invoke target/expression</li>
      <li class="unimplemented">Source File Information
        <ul>
          <li class="unimplemented">Media - DB or file-system</li>
          <li class="unimplemented">URI</li>
          <li class="unimplemented">Expression IDs by line #</li>
          <li class="unimplemented">Breakpoints</li>
          <li class="unimplemented">Functions - line, expr Id</li>
        </ul>
      </li>
      <li class="unimplemented">A link for each expression and it's text</li>
      <li class="unimplemented">Window sizes and placement</li>
    </ol>
  </div>
    
  <div id="config_info">
    <b>Display of Configuration information</b>
    <ol>
      <li>Users</li>
      <li>Roles</li>
      <li>Amps</li>
      <li>Collections</li>
      <li>Execute Privileges</li>
      <li>URI Privileges</li>
      <li>Permissions: <span class="unimplemented">(Explorer like tree view of directories and files)</span>
      <ul>
        <li class="unimplemented">Side by side view with users and roles</li>
        <li class="unimplemented">Highlight users with or without necessary roles to view/access files and directories.</li>
      </ul>
      </li>
    </ol>
  </div><br/>

</body>

</html>
